﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MangerList.aspx.cs" Inherits="HQWeb.Progect.ProgectManage.MangerList" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../Styles/GridViewStyle.css" rel="Stylesheet" type="text/css" />
    <script type="text/javascript" language="javascript">
        function expandcollapse(obj, row) {
            var div = document.getElementById(obj);
            var img = document.getElementById('img' + obj);

            if (div.style.display == "none") {
                div.style.display = "block";
                if (row == 'alt') {
                    img.src = "../../Images/collapse_blue.jpg";
                }
                else {
                    img.src = "../../Images/collapse_blue.jpg";
                }
                img.alt = "关闭显示";
            }
            else {
                div.style.display = "none";
                if (row == 'alt') {
                    img.src = "../../Images/expand_blue.jpg";
                }
                else {
                    img.src = "../../Images/expand_blue.jpg";
                }
                img.alt = "显示下级菜单";
            }
        } 
    </script>
</head>
<body>
    <form id="form1" runat="server">
     <asp:ScriptManager ID="ScriptManager" runat="server" />
    <ajaxToolkit:AutoCompleteExtender ID="ajaxtitel" runat="server" TargetControlID="txtName" ServicePath="../../Wbserver/GetSmartTips.asmx" 
    ServiceMethod="GetProjectName" MinimumPrefixLength="1" ></ajaxToolkit:AutoCompleteExtender> 
    <div>
        <div>
            &nbsp;名称： &nbsp;<asp:TextBox ID="txtName" runat="server"></asp:TextBox>&nbsp;&nbsp;
            &nbsp;<asp:Label runat="server" ID="LabTile" Text="所属分店："></asp:Label><asp:DropDownList
                runat="server" ID="drop_Branch">
            </asp:DropDownList>
            &nbsp;&nbsp;
            <asp:Button ID="bnSearch" runat="server" Text="查 询" OnClick="bnSearch_Click" />
            &nbsp;&nbsp;
            <asp:Button ID="btnAdd" runat="server" Text="添 加" OnClick="btnAdd_Click" />
        </div>
        <hr />
        <div>
            <asp:GridView ID="GridView1" CssClass="GridViewStyle" runat="server" AutoGenerateColumns="False"
                PageSize="25" Width="100%" AllowPaging="True" CellPadding="4" EmptyDataText="没有数据记录！！"
                OnPageIndexChanging="GridView1_PageIndexChanging" GridLines="None" DataKeyNames="a"
                OnRowDataBound="GridView1_RowDataBound" OnRowDeleting="GridView1_RowDeleting"
                OnRowEditing="GridView1_RowEditing">
                <Columns>
                    <asp:TemplateField ItemStyle-Width="5%">
                        <ItemTemplate>
                            <a href="javascript:expandcollapse('div<%# Eval("a") %>', 'one');">
                                <img id="imgdiv<%# Eval("a") %>" alt="点击显示/隐藏下级菜单 <%# Eval("a") %>" width="9px" border="0"
                                    src="../../Images/expand_blue.jpg" />
                            </a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="b" HeaderText="项目名称" ItemStyle-Width="25%" ItemStyle-HorizontalAlign="Center">
                        <ItemStyle Width="25%"></ItemStyle>
                    </asp:BoundField>
                    <asp:TemplateField ControlStyle-Width="96" HeaderText="图片" ItemStyle-Height="54px">
                        <ItemTemplate>
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("URLThumbnail")==DBNull.Value? "../../Images/Element/nophoto.bmp":Eval("URLThumbnail")%>'
                                Width="96px" Height="54px" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="c" HeaderText="价 格" ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Center">
                        <ItemStyle Width="20%"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="d" HeaderText="所属店" ItemStyle-Width="25%" ItemStyle-HorizontalAlign="Center">
                        <ItemStyle Width="25%"></ItemStyle>
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="操作" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="25%">
                        <ItemTemplate>
                            <asp:LinkButton ID="btnEdit" runat="server" Text="编 辑" CommandName="Edit" CommandArgument='<%#Eval("a")%>'></asp:LinkButton>
                            <asp:LinkButton ID="btnDelete" runat="server" Text="删 除" CommandName="Delete" CommandArgument='<%#Eval("a")%>'
                                OnClientClick=" return confirm('确定删除？')"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <tr>
                                <td colspan="100%">
                                    <div id="div<%# Eval("a") %>" style="display: none; position: relative; left: 15px;
                                        overflow: auto; width: 97%">
                                        <asp:GridView ID="GridView2" AllowPaging="False" AllowSorting="true" BackColor="White"
                                            Width="100%" AutoGenerateColumns="false" Font-Names="Verdana" runat="server"
                                            DataKeyNames="a" ShowFooter="true" OnRowDeleting="GridView2_RowDeleting" BorderStyle="Double"
                                            BorderColor="#0083C1">
                                            <RowStyle BackColor="Gainsboro" />
                                            <AlternatingRowStyle BackColor="White" />
                                            <HeaderStyle BackColor="#0083C1" ForeColor="White" />
                                            <FooterStyle BackColor="White" />
                                            <Columns>
                                                <asp:BoundField DataField="c" HeaderText="名称 " ItemStyle-HorizontalAlign="Center" />
                                                <asp:BoundField DataField="b" HeaderText="数量 " ItemStyle-HorizontalAlign="Center" />
                                                <asp:TemplateField HeaderText="功能" ItemStyle-HorizontalAlign="Center">
                                                    <ItemTemplate>
                                                        <asp:LinkButton ID="DelButton" Text="删除" CommandName="Delete" runat="server" />
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                        </asp:GridView>
                                    </div>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerTemplate>
                    <table width="100%">
                        <tr>
                            <td style="text-align: center">
                                第<asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1  %>' />页
                                共<asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount  %>' />页
                                <asp:LinkButton ID="btnFirst" runat="server" CausesValidation="False" CommandArgument="First"
                                    CommandName="Page" Text="首页" />
                                <asp:LinkButton ID="btnPrev" runat="server" CausesValidation="False" CommandArgument="Prev"
                                    CommandName="Page" Text="上一页" />
                                <asp:LinkButton ID="btnNext" runat="server" CausesValidation="False" CommandArgument="Next"
                                    CommandName="Page" Text="下一页" />
                                <asp:LinkButton ID="btnLast" runat="server" CausesValidation="False" CommandArgument="Last"
                                    CommandName="Page" Text="尾页" />
                                <asp:TextBox ID="txtNewPageIndex" runat="server" Width="28px" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1  %>' />
                                <asp:LinkButton ID="btnGo" runat="server" CausesValidation="False" CommandArgument="-1"
                                    CommandName="Page" Text="GO" /><!-- here set the CommandArgument of the Go Button to '-1' as the flag -->
                            </td>
                        </tr>
                    </table>
                </PagerTemplate>
                <FooterStyle CssClass="GridViewFooterStyle" />
                <RowStyle CssClass="GridViewRowStyle" />
                <SelectedRowStyle CssClass="GridViewSelectedRowStyle" />
                <PagerStyle CssClass="GridViewPagerStyle" />
                <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
                <HeaderStyle CssClass="GridViewHeaderStyle" />
            </asp:GridView>
        </div>
    </div>
    <div style="display: none">
        <asp:TextBox ID="txtPIdHid" runat="server" Style="visibility: hidden"></asp:TextBox>
    </div>
    </form>
</body>
</html>
